package exercise;

import java.text.DecimalFormat;

public class ex4 {
    public static void main(String[] args) {
        Circle circle = new Circle(10);
        System.out.printf("面积：%.2f 周长：%.2f",
                circle.getArea(), circle.getPerimeter());
        double area = circle.getArea();
        DecimalFormat df = new DecimalFormat("#.##");
        System.out.println();
        System.out.println(df.format(area));
    }
}

class Circle {
    private double radius;

    public Circle() {
    }

    public Circle(double radius) {
        this.radius = radius;
    }

    public double getArea() {
        return Math.PI * radius * radius;
    }

    public double getPerimeter() {
        return 2 * Math.PI * radius;
    }
}